<div class="footer">
    <div class="container">
	<ul class='menu-pages'>
	    <li><a href='<?php echo SITE_NAME_URL ?>'>Home</a></li>
	    <li><a href='<?php echo SITE_NAME_URL ?>about_us'>About Us</a></li>
	    <li><a href='<?php echo SITE_NAME_URL ?>help'>Help</a></li>
	    <li><a href='<?php echo SITE_NAME_URL ?>terms_of_use'>Terms of Use</a></li>
	    <li><a href='<?php echo SITE_NAME_URL ?>privacy_statement'>Privacy Statement</a></li>
	    <li><a href='<?php echo SITE_NAME_URL ?>contact_us'>Contact Us</a></li>
	</ul>
	<?php /*
	  <div class="colOne" style="width:370px;">
	  <div class="headerItem">About Us</div>
	  Finding a date online is now part of everyday life for millions of people across the world and enean lobortis justo tincidunt elit mollis vel auctor sapien auctor. Proin scelerisque, ipsum quis rhoncus ultricies, orci tortor dignissim leo, nec facilisis dolor felis ac erat.Aenean lobortis justo tincidunt elit mollis vel auctor sapien auctor.
	  </div>
	  <div class="colOne">
	  <ul>
	  <li class="headerItem">Quick Link</li>
	  <li><a href="#">About Us</a></li>
	  <li><a href="#">Help</a></li>
	  <li><a href="#">Sitemap</a></li>
	  <li><a href="#">Terms of Use</a></li>
	  <li><a href="#">Privacy Statement</a></li>
	  </ul>
	  </div>

	  <div class="colOne">
	  <ul>
	  <li class="headerItem">Recent Post</li>
	  <li><a href="#">Make first move</a></li>
	  <li><a href="#">Rhoncus Ultus</a></li>
	  <li><a href="#">Astrology</a></li>
	  <li><a href="#">Bad experience</a></li>
	  <li><a href="#">8 Dating Do</a></li>

	  </ul>
	  </div>

	  <div class="colOne colOne1">
	  <ul class="social">
	  <li class="headerItem">Support</li>
	  <li><a href="#" class="phone">Contact us via phone</a></li>
	  <li><a href="#" class="email">Contact us via mail</a></li>
	  <li><a href="#" class="bookmark">Bookmark Conversio</a></li>
	  <li><a href="#" class="signin">Sign up for free</a></li>

	  </ul>
	  </div>
	 * 
	 */ ?>


    </div><!--container-->

    <div class="footer-top">
	<div class="container">

	    &copy; Copyright 2012 Dating. All rights reserved
	</div><!--container-->
    </div><!--footer-top-->

</div><!--footer-->
<?php
/* ------------------------------------------CHAT BOX -------------------------------------------------- */
?>
<div id="wrap-all-box-chat">	    
</div>
<?php /* <script src="<?php echo WWW_URL ?>js/jquery.js"></script> */
?>


<script src="<?php echo WWW_URL ?>js/bootstrap-transition.js"></script>
<script src="<?php echo WWW_URL ?>js/bootstrap-alert.js"></script>
<script src="<?php echo WWW_URL ?>js/bootstrap-modal.js"></script>
<script src="<?php echo WWW_URL ?>js/bootstrap-dropdown.js"></script>
<script src="<?php echo WWW_URL ?>js/bootstrap-scrollspy.js"></script>
<script src="<?php echo WWW_URL ?>js/bootstrap-tab.js"></script>
<script src="<?php echo WWW_URL ?>js/bootstrap-tooltip.js"></script>
<script src="<?php echo WWW_URL ?>js/bootstrap-popover.js"></script>
<script src="<?php echo WWW_URL ?>js/bootstrap-button.js"></script>
<script src="<?php echo WWW_URL ?>js/bootstrap-collapse.js"></script>
<script src="<?php echo WWW_URL ?>js/bootstrap-carousel.js"></script>
<script src="<?php echo WWW_URL ?>js/bootstrap-typeahead.js"></script>
<script src="<?php echo WWW_URL ?>js/bootstrap-affix.js"></script>
<script src="<?php echo WWW_URL ?>js/holder/holder.js"></script>
<script src="<?php echo WWW_URL ?>js/google-code-prettify/prettify.js"></script>

<script src="<?php echo WWW_URL ?>js/application.js"></script>


<link rel="stylesheet" type="text/css" href="<?php echo WWW_URL ?>css/skin.css" />
<script type="text/javascript" src="<?php echo WWW_URL ?>js/jquery.jcarousel.min.js"></script>
<script type="text/javascript" src="<?php echo WWW_URL ?>js/jquery.form.js"></script>

<script type="text/javascript">

    function mycarousel_initCallback(carousel)
    {
	// Disable autoscrolling if the user clicks the prev or next button.
	carousel.buttonNext.bind('click', function() {
	    carousel.startAuto(0);
	});

	carousel.buttonPrev.bind('click', function() {
	    carousel.startAuto(0);
	});

	// Pause autoscrolling if the user moves with the cursor over the clip.
	carousel.clip.hover(function() {
	    carousel.stopAuto();
	}, function() {
	    carousel.startAuto();
	});
    }
    ;

    jQuery(document).ready(function() {
	jQuery('.mycarousel').jcarousel({
	    auto: 2,
	    wrap: 'last',
	    initCallback: mycarousel_initCallback
	});
    });
//    jQuery(document).ready(function() {
//	jQuery('#mycarousel1').jcarousel({
//	    auto: 2,
//	    wrap: 'last',
//	    initCallback: mycarousel_initCallback
//	});
//    });

</script>


<?php
//if user logged in, systerm will check online
if (user()->id && user()->getModel()->status == User::STATUS_ACTIVE) {
    ?>
    <script>
        $(document).ready(function() {
    	var siteUrl = $('#siteUrl').val();

    	/*****************************************************************
    	 * check if user sended to orther users, the chat box will show up.    
    	 */
    	var checkSendMsg = setInterval(function() {

    	    $.post(siteUrl + 'chat/check', {}, function(respond) {

    		var aUserChat = $.parseJSON(respond);

    		for (var i = 0; i < aUserChat.length; i++) {
    		    //check if the chat box with user is exist
    		    var checkBoxExist = $('#wrap-all-box-chat').find('#box-of-user' + aUserChat[i].user_send);
    		    if (checkBoxExist.prop('tagName') != null) {
    			//not show box again

    			//check if there is any message on the box
    			var checkMsgExist = checkBoxExist.find('li').prop('tagName');

    			if (checkMsgExist == null) {
    			    /*
    			     * add message to this box
    			     */
    			    //				    <li time-created="' . $message->time_created . '">' . $message->username_send . ': ' . $message->message . '</li>
    			    checkBoxExist.find('ul').append('<li time-created="' + aUserChat[i].time_created + '">' + aUserChat[i].username_send + ': ' + aUserChat[i].message + '</li>');
    			}
    		    } else {

    			var idSender = aUserChat[i].user_send;
    			var usernameSend = aUserChat[i].username_send;

    			/*
    			 * add new chat box
    			 */
    			var displayName = aUserChat[i].username_send.substring(0, 10);
    			$('#wrap-all-box-chat').append('<div class="box-chat"><div class="name-chat alert alert-info"><img class="status-online" src="' + siteUrl + 'www/img/icon-online.png"/>Chat with ' + displayName + '<i class="icon-remove-sign remove-box-chat" title="Close"></i></div><div class="content-chat" id="box-of-user' + aUserChat[i].user_send + '"><ul><li time-created="' + aUserChat[i].time_created + '">' + aUserChat[i].username_send + ': ' + aUserChat[i].message + '</li></ul></div><div class="compose-chat"><textarea placeholder="Press enter to send messages" class="txt-chat" id-user="' + aUserChat[i].user_send + '" user-name="' + aUserChat[i].username_send + '"></textarea></div></div>');

    			//after 8s get news message
    			var refreshChatBox = setInterval(function() {

    			    //check if there is any message
    			    var timeLastMsg = $('#box-of-user' + idSender + ' ul').find('li').last().attr('time-created');
    			    if (timeLastMsg != null) {

    				//get more message
    				$.post(siteUrl + 'chat/getmsg', {timeLastMsg: timeLastMsg, idUser: idSender}, function(result) {
    				    $('#box-of-user' + idSender + ' ul').append(result);
    				});
    			    }
    			    /*			 
    			     * check if user is online
    			     */
    			    $.post(siteUrl + 'chat/checkonline', {idUser: idSender}, function(response) {
    				if (response == 'true') {
    				    $('#box-of-user' + idSender).parent().find('img').attr('src', siteUrl + 'www/img/icon-online.png');
    				} else {
    				    $('#box-of-user' + idSender).parent().find('img').attr('src', siteUrl + 'www/img/icon-offline.png');
    				}
    			    });

    			}, 5000);
    			/*
    			 * Close chat box
    			 */
    			$('#box-of-user' + idSender).parent().find('.remove-box-chat').click(function() {

    			    //remove chat box
    			    $('#box-of-user' + idSender).parent().remove();
    			    //clear interval for this chat box
    			    clearInterval(refreshChatBox);
    			});
    		    }

    		}
    	    });
    	}, 8000);
        });


    </script>

    <script>
    <?php
    /**
     * after authenticating, the checkbox which is used to post to social will be shown
     */
    ?>
        function afterOauth() {
    	$('.wrap-input-social').html("<input type='checkbox' name='isSendFacebook'/> Send to Facebook");
        }
        $(document).ready(function() {
    <?php
//show popup for authenticate
    ?>
    	$('.connect-facebook').click(function() {
    	    window.open('<?php echo SITE_NAME_URL ?>site/oauth?provider=Facebook&is_connect=1', 'windowname1', 'width=1000, height=500');
    	});
        });

    </script>
<?php } ?>
<script src="<?php echo WWW_URL ?>js/custom.js"></script>

